package com.ys.erp.gateway.config;

import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * @author lwj
 * @date 2024/9/2
 */
@SpringBootConfiguration
public class HttpsConfig {


    @Bean
    public CloseableHttpClient httpClient() throws Exception {
        SSLContextBuilder sslContextBuilder = SSLContextBuilder.create();
        // Configure SSL context

        return HttpClients.custom()
                .setSSLContext(sslContextBuilder.build())
                .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
                .build();
    }

}
